package aps

import glory.xxd.Utils
import org.json.JSONObject

class ShowMeterialInputDataController {

    def commentService

    /**
     * <Request>
     <Header>
     <TRANSACTIONID>8c3f8423-51ef-4a23-bb38-a26aba909db5</TRANSACTIONID>
     <MESSAGENAME>ShowMeterialInputData</MESSAGENAME>
     <USERNAME>EAP</USERNAME>
     </Header>
     <Body class="Body">
     <EqpId>1FS05</EqpId>
     <USERNAME>G2976</USERNAME>
     <Type>WaferSaw</Type>
     </Body>
     </Request>
     */
    def index() {
        def EqpId = params.EqpId ?: ""
        def USERNAME = params.USERNAME ?: ""
        def Type = params.Type ?: ""

        def body =JSONObject.newInstance()
        body.put("EqpId",EqpId)
        body.put("USERNAME",USERNAME)
        body.put("Type",Type)

        String logUUID = Utils.getUUID();
        def header = JSONObject.newInstance()
        header.put("MESSAGENAME","ShowMeterialInputData")
        header.put("TRANSACTIONID",logUUID)
        header.put("USERNAME",'PDA')

        def jsonAll = [Header:header,Body:body] //JSONObject.newInstance()

        def jsonRequest = JSONObject.newInstance()
        jsonRequest.put("Request",jsonAll)

        def json = commentService.getJsonByJsonForTopic2Queue(logUUID, jsonRequest)

        render json
    }
}
